import React, {Component} from 'react';
import Markdown from 'react-markdown';
import {Anchor, Row, Col} from 'antd';

const {Link} = Anchor;

class JsPage extends Component {
    constructor(props) {
        super(props);
    }
    render() {

        return (
            <div style={{background:"#c0d2bc"}}>
                <Row>
                    <Col span={19}>
                        <h3 id="map"> map </h3>
                        <hr/>
                        <p ><font style={{color:"#ff3a47"}}>ConcurrentMap/Hashtable不允许key、value为null?</font></p>
                        <Markdown source={"HashMap允许插入key和value是null的数据的，而ConcurrentHashMap是不允许key和value是null的。这个是为什么呢？ConcurrentHashMap的作者是这么说的： \n" +
                        "\n" +
                        "The main reason that nulls aren’t allowed in ConcurrentMaps (ConcurrentHashMaps, ConcurrentSkipListMaps) is that ambiguities that may be just barely tolerable in non-concurrent maps can’t be accommodated. The main one is that if map.get(key) returns null, you can’t detect whether the key explicitly maps to null vs the key isn’t mapped. In a non-concurrent map, you can check this via map.contains(key), but in a concurrent one, the map might have changed between calls. \n" +
                        "\n" +
                        "ConcurrentHashmap和Hashtable都是支持并发的，这样会有一个问题，当你通过get(k)获取对应的value时，如果获取到的是null时，你无法判断，它是put（k,v）的时候value为null，还是这个key从来没有做过映射。HashMap是非并发的，可以通过contains(key)来做这个判断。而支持并发的Map在调用m.contains（key）和m.get(key),m可能已经不同了。\n"}/>
                        <hr/>



                        <h3 id="Producer"> Producer </h3>
                        <Markdown source={"不能写冒点。"}/>
                        <h3 id="Consumer"> Consumer </h3>
                        <div align="center"><img style={{maxHeight:"500px"}} src=""/></div>
                        <Markdown source={"不能写冒点。"}/>

                    </Col>
                    <Col span={5}>
                        <Anchor showInkInFixed="true" style={{background:"#ebefe0"}}>
                            <Link href="#map" title="map"/>
                            <Link href="#Producer" title="Producer"/>
                            <Link href="#Consumer" title="Consumer"/>

                        </Anchor>
                    </Col>
                </Row>
            </div>

        );
    }
}

export default JsPage;